package viewdatabase;

import general.art.*;
import general.guicontrols.clusterpanels.BasicDisplay;
import general.guicontrols.layoutmanager.DiagonalLayout;
import java.awt.Dimension;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.SwingUtilities;

/**
 *
 * @author tom3
 *
 */
public final class DiagonalGUI{

	/**
	 *
	 */
	private final static int PREFREDED_WIDTH = 1200;

	/**
	 * 
	 */
	private final static int PREFREDED_HIEGHT = 900;

	/**
	 *
	 */
	private JFrame mFrame;
	private DiagonalGUI(final int seedNode, final int depth) {
		
		mFrame = new JFrame();
		mFrame.setTitle("Seed Node id: " + seedNode + ", Cluster Depth: " + depth);
		//mFrame.setLayout( new GridBagLayout());
		
		mFrame.setSize( new Dimension(PREFREDED_WIDTH, PREFREDED_HIEGHT));

		try{
		
			Cluster myCluster = new Cluster(seedNode, depth);
			BasicDisplay myDisplay  =  new BasicDisplay(myCluster);
			
			myDisplay.setLayout( new DiagonalLayout());
			
			mFrame.add(myDisplay );

		}catch(Exception ex){

			mFrame.add(new JLabel(ex.toString()));

		}

		mFrame.pack();
		mFrame.setVisible(true);
		mFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	}

	/**
	 *@return is the Interface that the projects runs on
	 */
	public static void createInterFace(final int seedNode , final int depth){
		
		SwingUtilities.invokeLater(new Runnable(){

			public void run(){

				new DiagonalGUI(seedNode, depth);

			}

		});
		
		//return new MyInterface();
	}

	/**
	 * @param args the parameter arguments is the arguments that program gets on start up
	 */
	public static void main(final String [] args){

		
		
		createInterFace(10, 1);
		//createInterFace(10, 3);
	}

}
